<?php

namespace maotool\core\validate;

use maotool\core\validate\validator\DefaultValidator;

class FormValidateRuleData
{

    /**
     * @var bool
     */
    private $required;

    /**
     * @var string
     */
    private $message;

    /**
     * @var int
     */
    private $min;

    /**
     * @var int
     */
    private $max;

    /**
     * @var object
     */
    private $validator;

    /**
     * @var list<object>
     */
    private $results;

    /**
     * @param $required
     * @param $message
     * @param $min
     * @param $max
     * @param $validator
     * @param $results
     */
    public function __construct($required = false, $message = "请输入值", $min = 0, $max = 0, $validator = DefaultValidator::class, $results = [])
    {
        $this->required = $required;
        $this->message = $message;
        $this->min = $min;
        $this->max = $max;
        $this->validator = $validator;
        $this->results = $results;
    }

    /**
     * @return bool
     */
    public function isRequired()
    {
        return $this->required;
    }

    /**
     * @param bool $required
     */
    public function setRequired($required)
    {
        $this->required = $required;
    }

    /**
     * @return string
     */
    public function getMessage()
    {
        return $this->message;
    }

    /**
     * @param string $message
     */
    public function setMessage($message)
    {
        $this->message = $message;
    }

    /**
     * @return int
     */
    public function getMin()
    {
        return $this->min;
    }

    /**
     * @param int $min
     */
    public function setMin($min)
    {
        $this->min = $min;
    }

    /**
     * @return int
     */
    public function getMax()
    {
        return $this->max;
    }

    /**
     * @param int $max
     */
    public function setMax($max)
    {
        $this->max = $max;
    }

    /**
     * @return FormValidator
     */
    public function getValidator()
    {
        return $this->validator;
    }

    /**
     * @param FormValidator $validator
     */
    public function setValidator($validator)
    {
        $this->validator = $validator;
    }

    /**
     * @return object[]
     */
    public function getResults()
    {
        return $this->results;
    }

    /**
     * @param object[] $results
     */
    public function setResults($results)
    {
        $this->results = $results;
    }

}